package com.aaa.controller;


import com.aaa.entity.TenementCompany;
import com.aaa.query.TenementCompanyQuery;
import com.aaa.result.Result;
import com.aaa.service.TenementCompanyServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * create by: 刘涛
 * description: 租户管理-单位表
 * create time: 2021/1/25 18:58
 * 
  * @Param: null
 * @return
 */

@RestController
@RequestMapping("/company")
public class TenementCompanyController {

    @Autowired
    private TenementCompanyServiceImpl service;


    /**
     * create by: 刘涛
     * description: 租户管理-企业表查询业务   模糊查询+分页+查询
     * create time: 2021/1/25 19:03
     *
     * @return
     * @Param: null
     */
    @GetMapping("/list")
    public Result listAll(@RequestBody TenementCompanyQuery query) {
        return service.listAll(query);

    }

    /**
     * create by: 刘涛
     * description: 租户管理-企业表添加业务
     * create time: 2021/1/30 19:32
     *
      * @Param: null
     * @return
     */
    @PutMapping("/add")
    public Result add(@RequestBody TenementCompany tenementCompany){
        return service.add(tenementCompany);
    }

    /**
     * create by: 刘涛
     * description: 租户管理-企业表删除业务
     * create time: 2021/2/20 9:43
     *
      * @Param: null
     * @return
     */
    @DeleteMapping ("/delete")
    public Result delete(@RequestBody TenementCompany tenementCompany){
        return service.del(tenementCompany);
    }

    /**
     * create by: 刘涛
     * description: 租户管理-企业表修改业务
     * create time: 2021/2/24 14:58
     *
      * @Param: null
     * @return
     */
    @PostMapping("/update")
    public Result update(@RequestBody TenementCompany tenementCompany){
        return service.updateCompany(tenementCompany);
    }
}

